#pragma once

#include <QWidget>
#include "ui_TalkWindow.h"
#include <qjsonarray.h>

class TalkWindow : public QWidget
{
	Q_OBJECT

public:
	TalkWindow(const int &id,QWidget *parent = Q_NULLPTR);
	~TalkWindow();

	void setWindowName(const QString& name);
	void addEmotionImage(int name);
	int getTalkId();

	void appendObjectMsg(const QJsonArray& jsonMsg,QString obj);


private:
	void init();
	//void initTalkType();
	void initStyle();
	void initConnect();

	void initTalkWindow();
	void initGroupTalk();
	void initSingleTalk();


	QJsonArray parseDocumentToJson(QTextDocument* document);
	void addMember(QTreeWidgetItem* rootItem, const QPair<QString, QString>& info);



private slots:
	void onSendBtnClicked();
	void onTreeItemDoubleClicked(QTreeWidgetItem* item);
	void onFileOpenBtnClicked();

private:
	Ui::TalkWindow ui;

	const int talkId;
	//bool isGroupTalk;

};
